package com.example.jobback.controller.seeker;

import com.example.jobback.resp.seeker.position.CollectResp;
import com.example.jobback.resp.seeker.position.GetPositionDetailResp;
import com.example.jobback.resp.seeker.position.GetRecruiterPositionResp;
import com.example.jobback.resp.seeker.position.SeekerCandidateResp;
import com.example.jobback.result.Result;
import com.example.jobback.service.seeker.SeekerPositionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: SeekerPositionController
 * @Description:求职者-职位控制器
 * @Author: lhb
 * @Date: 2025/7/15
 */
@RestController
@RequestMapping("/seeker/position")
@Tag(name = "求职者-职位控制器",description = "求职者职位服务对应的相关接口")
public class SeekerPositionController {

    private final SeekerPositionService seekerPositionService;

    public SeekerPositionController(SeekerPositionService seekerPositionService) {
        this.seekerPositionService = seekerPositionService;
    }

    @Operation(summary = "获取热门职位城市",description = "这里的热门城市指的是，岗位数较多的城市")
    @ApiResponse(description = "返回set的字符串集合，测试阶段如果为空，忽略掉")
    @GetMapping("/getHotCityList")
    public Result<Object> getHotCityList(){
        return seekerPositionService.getHotCityList();
    }

    @Operation(summary = "根据userId获取该人发布的岗位",description = "投递管理的一环，同时，查看招聘者详细也把这个接口用上")
    @ApiResponse(description = "返回响应体")
    @GetMapping("/getRecruiterPositions")
    public Result<List<GetRecruiterPositionResp>> getRecruiterPositions(@Parameter(description = "指定用户的userId", required = true)
                                                   @RequestParam Long userId){
        return seekerPositionService.getRecruiterPositions(userId);
    }

    @Operation(summary = "根据职位id查看职位详细",description = "无")
    @ApiResponse(description = "返回响应体")
    @GetMapping("/getPositionDetail")
    public Result<GetPositionDetailResp> getPositionDetail(@Parameter(description = "职位id", required = true)
                                                                        @RequestParam Long positionId){
        return seekerPositionService.getPositionDetail(positionId);
    }

    @Operation(summary = "投递岗位",description = "")
    @ApiResponse(description = "返回token")
    @PostMapping("/deliverPositionById")
    public Result<Object> deliverPositionById(@Parameter(description = "职位id", required = true)
                                              @RequestParam Long positionId){
        return seekerPositionService.deliverPositionById(positionId);
    }

    @Operation(summary = "获取已投递",description = "")
    @ApiResponse(description = "返回响应体列表")
    @GetMapping("/getDeliverList")
    public Result<List<SeekerCandidateResp>> getDeliverList(){
        return seekerPositionService.getDeliverList();
    }


    @Operation(summary = "获取已面试",description = "")
    @ApiResponse(description = "返回响应体列表")
    @GetMapping("/getInterviewList")
    public Result<List<SeekerCandidateResp>> getInterviewList(){
        return seekerPositionService.getInterviewList();
    }

    @Operation(summary = "收藏岗位",description = "")
    @ApiResponse(description = "")
    @PostMapping("/collectPositionById")
    public Result<Object> collectPositionById(@Parameter(description = "职位id", required = true)
                                              @RequestParam Long positionId,
                                              @Parameter(description = "是否收藏,true为收藏", required = true)
                                              @RequestParam Boolean status){
        return seekerPositionService.collectPositionById(positionId, status);
    }

    @Operation(summary = "获取已收藏列表",description = "")
    @ApiResponse(description = "返回响应体列表")
    @GetMapping("/getCollectList")
    public Result<List<CollectResp>> getCollectList(){
        return seekerPositionService.getCollectList();
    }

    @Operation(summary = "判断是否已收藏",description = "")
    @ApiResponse(description = "返回boolean值，true为已收藏")
    @GetMapping("/judgeCollect")
    public Result<Object> judgeCollect(@Parameter(description = "职位id", required = true)
                                           @RequestParam Long positionId){
        return seekerPositionService.judgeCollect(positionId);
    }


}
